package com.kl.example.serializer;

import com.alibaba.fastjson.JSON;
import com.kl.example.model.MessageModelExample;
import org.apache.kafka.common.serialization.Deserializer;

/**
 * 基于fastjson的反序列化器
 */
public class MyMessageJsonDeserializer implements Deserializer<MessageModelExample> {

    /**
     * 直接使用第三方工具反序列化
     */
    @Override
    public MessageModelExample deserialize(String topic, byte[] data) {
        return JSON.parseObject(data, MessageModelExample.class);
    }
}
